|
A full cycle or full period is a mathematical term that describes the behavior of a pseudorandom number generator (PRNG) over its set of valid states. In particular, a PRNG is said to have a full cycle if, for any valid seed state, the PRNG traverses every valid state before returning to the seed state, i.e. the period is equal to the cardinality of the state space. The restrictions on the parameters of a PRNG for it to possess a full cycle are known only for certain types of PRNGs, such as, but not limited to, linear congruential generators and linear feedback shift registers. There is no general method to determine whether a PRNG algorithm is full-cycle short of exhausting the state space, which may be exponentially large compared to the size of the algorithm's internal state. ==Example 1 (in C++)== Given a random number seed that is greater or equal to zero, a total sample size greater than 1, and an increment coprime to the total sample size, a full cycle can be generated with the following logic. Each nonnegative number smaller than the sample size occurs exactly once. unsigned int seed = 0; unsigned int sample_size = 3000; unsigned int generated_number = seed % sample_size; unsigned int increment = 7; for(unsigned int iterator = 0; iterator < sample_size; ++iterator) 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Full cycle」の詳細全文を読む スポンサード リンク
|